//    Copyright (C) Kherty.  All rights reserved.
using System.Windows;
using System.Windows.Input;
using OpenLS.Spreadsheet.Data;
using OpenLS.UI;

namespace OpenLS.Spreadsheet.UI
{
    class GridGetData
    {
        internal static void EnableCommands(UIElement grid)
        {
            grid.CommandBindings.Add(new CommandBinding(SpreadsheetCommands.GetDataFromText, OnGetData, Always));
        }

        private static void Always(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
            e.Handled = true;
        }

        private static void OnGetData(object sender, ExecutedRoutedEventArgs e)
        {
            var d = new OpenFileDialog();

            if (d.ShowDialog().GetValueOrDefault())
            {
                string fileName = d.FileName;
                TextConnection connection = new TextConnection();
                
            }
        }
    }
}